package com.shpng.cheapenglish.action;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.shpng.cheapenglish.entity.SUser;
import com.shpng.cheapenglish.entity.SUserWord;
import com.shpng.cheapenglish.manager.UserManager;
import com.shpng.cheapenglish.manager.WordManager;

public class GetMyWordAction {

	public String execute(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		WordManager wordManager = WordManager.getInstance();
		UserManager userManager = UserManager.getInstance();
		SUser user = userManager.getUser((String) req.getSession()
				.getAttribute("email"));
		List<SUserWord> userWords = wordManager.getUserWords(user);
		req.setAttribute("userWords", userWords);
		return "/pages/my-user-word.jsp";
	}
}
